feat(risk): composite risk scoring model with explainable factors (#252)#271
Open
Shikhar-404exe wants to merge 1 commit into
Open
feat(risk): composite risk scoring model with explainable factors (#252)#271Shikhar-404exe wants to merge 1 commit into
Shikhar-404exe wants to merge 1 commit into
Conversation
…ksh1#252) - Composite weighted score: severity (30%), exploitability (25%), asset exposure (20%), recency (15%), confidence (10%) - Finding model extended with exploitability, confidence, asset_exposure, risk_score, risk_factors fields + DB migration - API exposes risk_score, risk_factors, avg_risk_score on findings and dashboard endpoints - Frontend shows color-coded Risk Score card and per-factor breakdown in Findings sidebar and TaskDetails drawer - 17 backend unit tests for scoring determinism, bounds, defaults, edges - 7 frontend tests for risk score visibility and coloring
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements a deterministic, explainable risk scoring model that prioritizes findings using five weighted factors.
#252
Scoring Formula
risk_score = severity×0.30 + exploitability×0.25 + asset_exposure×0.20 + recency×0.15 + confidence×0.10Each factor includes a human-readable explanation of its contribution (label, raw value, score out of 10, weight, contribution, detail string).
Backend Changes
backend/secuscan/risk_scoring.py— scoring algorithm withcompute_risk_score()andgenerate_risk_factors()backend/secuscan/models.py—Findingmodel extended withexploitability,confidence,asset_exposure,risk_score,risk_factorsbackend/secuscan/database.py— schema migration for 4 new columnsbackend/secuscan/executor.py—_compute_and_set_risk_score()called on finding upsert in both sync and async pathsbackend/secuscan/routes.py—risk_score,risk_factors,avg_risk_scoreexposed onGET /findings,GET /finding/{id},GET /dashboard/summaryFrontend Changes
Findings.tsx— sidebar shows color-coded Risk Score card (red ≥7, amber 4–6.9, blue <4) with per-factor breakdownTaskDetails.tsx— FindingDrawer shows Risk Score and factor breakdownTesting
testing/backend/unit/test_risk_scoring.pycovering:frontend/testing/unit/pages/Findings.test.tsxcovering: